<extend name="Public/common" />
<block name="body">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>编辑用户</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="form-horizontal">
                            <input type="hidden" name="user_id" value="{$user.id}">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">用户名</label>

                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="username" value="{$user.username}" placeholder="请填写用户名" id="username">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">上传头像</label>
                                <div class="col-sm-10">
                                    <if condition="($user['images_id'] neq '')"><img src="{:getImage($user['images_id'])}" class="images" style="width:100px;margin-bottom: 2px;"/></if>
                                    <!--dom结构部分-->
                                    <div id="uploader-demo">
                                        <!--用来存放item-->
                                        <div id="fileList" class="uploader-list" style="width:100px;"></div>
                                        <div id="filePicker"><i class="fa fa-upload"></i> 选择图片</div>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">密码</label>

                                <div class="col-sm-10">
                                    <input type="password" class="form-control" name="password" placeholder="请填写密码(选填)" id="password">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">确认密码</label>

                                <div class="col-sm-10">
                                    <input type="password" class="form-control" name="confirm" placeholder="请填写确认密码(选填)" id="confirm">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">
                                    状态
                                </label>

                                <div class="col-sm-10">
                                    <div class="radio i-checks">
                                        <label><input type="radio" value="0" name="status" <if condition="($user['status'] eq 0)"> checked="checked" </if> > <i></i>启用</label>
                                        <label><input type="radio" value="1" name="status" <if condition="($user['status'] eq 1)"> checked="checked" </if> > <i></i>禁用</label>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">角色</label>

                                <div class="col-sm-10">
                                    <select class="form-control m-b" name="role_id" id="role_id">
                                        <volist name="role" id="role">

                                            <option value="{$role.id}" <if condition="($role['id'] eq $user['role_id'])"> selected="selected" </if> >{$role.name}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" id="save">保存内容</button>
                                    <button class="btn btn-white" type="button" onclick="history.go(-1);">返回</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        //定义全局变量
        var GV = {
            user_edituser : "{:U('User/editUser')}",
            user_is_username : "{:U('User/is_username')}",
            user_getusername : "{:U('User/getUsername')}"
        };
    </script>
    <script src="__JS__/http/user/edituser.js"></script>
    <script src="__JS__/http/upload.js"></script>
</block>